package com.xxwy.springboot.webflux.repository;

import com.xxwy.springboot.webflux.document.User;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;

/**
 * @author xxwy
 * 表示着是一个仓库
 */
@Repository
public interface UserRepository extends ReactiveMongoRepository<User,String> {

    Flux<User> findByAgeBetween(int start,int end);

    @Query("{'age':{'$gte':40,'$lte':50}}")
    Flux<User> oldUser();
}
